package com.briup.sms.web.controller;

import com.briup.sms.entity.Category;
import com.briup.sms.entity.ext.CategoryExtend;
import com.briup.sms.service.CategoryService;
import com.briup.sms.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
@Api(tags = "分类管理")
public class CategoryController {
    @Autowired
    private CategoryService service;

    @ApiOperation("查询全部分类信息")
    @GetMapping("findCategoryInfo")
    public Result findCategoryInfo(){
        List<CategoryExtend> list = service.findCategoryInfo();
        return  Result.success(list);
    }

    @ApiOperation("查询全部一级分类")
    @GetMapping("/findCategorysOneLevel")
    public Result findCategorysOneLevel(){
        List<Category> list = service.findCategorysOneLevel();
        return Result.success(list);

    }

}
